home *** CD-ROM | disk | FTP | other *** search
Text File | 1998-03-19 | 4.8 KB | 145 lines | [TEXT/MPS ] |
- #########################################################################
- #########################################################################
- ## Copyright © Apple Computer, Inc. 1992-1997
- ## All rights reserved
- #########################################################################
- #########################################################################
- #
- # Library: 68040CacheSwitch.lib
- #
- # Version: 2.1.4
- #
- # Description: Tasks that handle the Cache Switch control panel.
- # It turns on and off the 68040 Caches for compatibility.
- # Not really needed in 1995, because broken apps have
- # been fixed or discontinued.
- #
- # Contains:
- # CacheSwitchCP()
- #
- # History:
- # Date: By: Changes:
- # 11/03/92 NMS Created
- # 06/05/93 SBR changes to CacheSwitchCP()
- # 09/03/94 SBR changes to CacheSwitchCP()
- # 09/23/94 SBR changes to CacheSwitchCP()
- # 09/04/95 SBR Added this header for Radar 1273927
- # Formatted according to standards.
- # 09/27/96 SBR/MSO Updated copyright header
- # Use SPEC exception handling method (ExceptionHandling.lib)
- # 01/21/97 SBR Deleted older exception code and comments.
- #
- #########################################################################
- #########################################################################
-
- Libraries
- "Clouseau.lib",
- "ExceptionHandling.lib",
- "Report.lib",
- "TargetControl.lib";
-
- #########################################################################
- # task CacheSwitchCP(speed, v_level)
- #∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞
- # Author: NS
- # Description: Determines if the CPU has a 68040, if not returns undefined.
- # If it has a 68040 it tries to open the Cache Switch control
- # Panel. If it can't it returns true, assuming the caches are on.
- # If it can open the CP, it sets the cache according to the speed
- # parameter. True ensures it is on and false turns it off. If
- # the Control Panel is already set to the correct position it
- # does nothing.
- # Parameters: speed := true = Set fast
- # false = Set slow
- # undefined (default) = Get current state
- # Returns: Set: Success (true) or failure (false) or not 68040 (undefined)
- # Get: Fast (true) or Slow (false) or not 68040 (undefined)
- # Example: CacheSwitchCP(true);
- #∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞
- # History Who What
- # 11/03/92 NMS Created
- # 06/05/93 SBR Uses get_target_info() instead of explicit globals
- # 09/03/94 SBR Added error handling for target access
- # 09/23/94 SBR Now closes Control panels window in open_control_panel()
- #########################################################################
- task CacheSwitchCP(speed := undefined, v_level := 5)
- begin
- fastClick := {110,49}; #top FAST button
- slowClick := {110,68}; #bottom SLOW button
-
- processorType := get_target_info('processor#');
- if isUndefined(processorType)
- processorType := _Gestalt('proc')[2][2];
- if not (processorType = 5)
- begin
- RStatus("CacheSwitchCP: Target's CPU is not a 68040", v_level);
- return undefined;
- end;
-
- ohFortyCaches := get_target_info('68040CacheCP#');
- if isUndefined(speed) and not isUndefined(ohFortyCaches)
- return ohFortyCaches;
-
- triedOnce := false;
- while true
- begin
- await_presence([menuItem t:'Control Panels' m:1],,,,6);
- if not open_control_panel("Cache Switch", true)
- return true; # assume caches are on if there is no Cache Switch CP
-
- try
- match [radioButton s:$b w:1]; # get the list of button settings
- catch theError
- ExceptionDispatcher(theError,,{"CacheSwitchCP", {speed}});
-
- if b[2] = { 1, 1 }
- ohFortyCaches := 'on';
- else
- ohFortyCaches := 'off';
-
- if isUndefined(speed)
- begin
- key_eq('w'); # 09/23/94 SBR: was 'ww'
- RStatus("CacheSwitchCP: 68040 caches are On", v_level);
- return ohFortyCaches = 'on';
- end;
- if speed
- begin # user wants FAST
- if b[2] = { 1, 1 }
- begin
- key_eq('ww');
- return RStatus("CacheSwitchCP: 68040 caches are On", v_level);
- end;
- else
- begin
- if triedOnce
- return RError("CacheSwitchCP: Failed to turn on 68040 caches.", v_level);
- move_mouse({ fastClick, 'click' });
- triedOnce := true;
- RStatus("CacheSwitchCP: 68040 caches have been turned on. Restarting…", v_level);
- restart_target();
- end;
- end;
- else
- begin # user wants SLOW
- if b[1] = { 1, 1 }
- begin
- key_eq('ww');
- RStatus("CacheSwitchCP: 68040 caches are Off", v_level);
- return false;
- end;
- else
- begin
- if triedOnce
- return RError("CacheSwitchCP: Failed to turn off 68040 caches.", v_level);
- move_mouse({ slowClick, 'click' });
- triedOnce := true;
- RStatus("CacheSwitchCP: 68040 caches have been turned off. Restarting…", v_level);
- restart_target();
- end;
- end;
- end;
- end;
-
-
-